﻿@{
    ViewBag.Title = "奖金明细";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script>

    $(function() {
        gridList();
    });

    function gridList() {
        var $gridList = $("#gridList");

        var postData = {
            BonusType: $("#txt_BonusType").val(),
            OrderTimeStart: $("#txt_startDate").val(),
            OrderTimeEnd: $("#txt_endDate").val()
        };
        $gridList.dataGrid({
            url: "/MemberManage/MemberBonusDetail/GetListForBonus",
            postData: postData,
            height: $(window).height() - 158,
            colModel: [
                {
                    label: '订单号', name: 'F_OrderId', width: 150, align: 'center'
                    /*formatter: function (cellvalue, options, rowObject) {
                        if (rowObject.F_BonusType == 0) {
                            return rowObject.F_OrderId;
                        } else {
                            return "--";
                        }
                    }*/
                },
                { label: '代理商/中转中心', name: 'RealName', width: 150, align: 'center' },
                {
                    label: '所得积分',
                    name: 'F_BonusAmount',
                    width: 100,
                    align: 'center',
                    formatter: function (cellvalue, options, rowObject) {
                        return cellvalue == null ? "" : parseFloat(cellvalue).toFixed(2);
                    }
                },
                { label: '积分所得来源', name: 'OrderMemberName', width: 150, align: 'center' },
                {
                    label: '积分所得类型', name: 'F_BonusType', width: 100, align: 'center', sortable: false,
                    formatter: function (cellvalue) {
                        switch (cellvalue) {
                        case 0: return "广告"; break;
                            case 1: return "消费补贴"; break;
                        case 2: return "中转中心劳务"; break;
                            case 3: return "经理奖励"; break;
                            case 10: return "订单退费"; break;
                        }
                    }
                },
                /*{ label: '分红等级', name: 'F_BonusLevel', width: 150, align: 'center' },*/
                { label: '积分所得时间', name: 'F_BonusTime', width: 150, align: 'center' },
                { label: '备注', name: 'F_bz',  align: 'left' }
            ],
            pager: "#gridPager",
            sortname: 'F_BonusTime desc',
            viewrecords: true
        });

        $("#btn_search").click(function() {
            var postData = {
                BonusType: $("#txt_BonusType").val(),
                OrderTimeStart: $("#txt_startDate").val(),
                OrderTimeEnd: $("#txt_endDate").val()
            };
            $gridList.jqGrid('setGridParam',
            {
                postData: postData
            }).trigger('reloadGrid');
        });
    }

</script>
<div class="topPanel">
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <select id="txt_BonusType" class="form-control" style="width: 200px;  margin-right: 10px">
                            <option value="-1" selected="selected">请选择积分所得类型</option>
                            <option value="0">广告</option>
                            <option value="1">消费补贴</option>
                            <option value="2">中转中心劳务</option>
                            <option value="3">经理奖励</option>
                        </select>

                        <input id="txt_startDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="积分所得日期" style="width: 150px;"/>
                        --
                        <span style="float: right; margin-left: 3px;">
                            <input id="txt_endDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="积分所得日期" style="width: 150px;"/>
                        </span>
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" title="搜索">
                                <i class="fa fa-search"></i>
                            </button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()">
                <span class="glyphicon glyphicon-refresh"></span>
            </a>
        </div>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>